package se.webbzon.oschi01.nbt;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import se.webbzon.oschi01.singleton.Singleton;

public class ShortTagFactory extends AbstractTagFactory<Short> implements Singleton {

	private ShortTagFactory() {
		super(Tags.TAG_SHORT, "TAG_Short");
	}

	@Override public ShortTag readTag(String tagName, DataInputStream is) throws IOException {
		return new ShortTag(this, tagName,is.readShort());
	}

	@Override public void writeTag(Tag<Short> tag, DataOutputStream dos) throws IOException {
		dos.writeShort(tag.getValue());
	}

	@Override public Tag<Short> createTag(String tagName) {
		return new ShortTag(this, tagName, (short) 0);
	}

}
